/**
 * 
 */
package hihocoder;

import java.util.Scanner;
import java.util.Stack;

/**
 * @author zhongfang
 *
 */
public class 股票价格3 {

	public static int[] nextGreater(int[] A) {
		int[] B = new int[A.length];
		for (int i = 0; i < B.length; i++) {
			B[i] = -1;
		}
		Stack<Integer> stackIndex = new Stack<>();
		for (int i = 0; i < A.length; i++) {
			while (!stackIndex.isEmpty() && A[stackIndex.peek()] < A[i]) {// 当前使得栈内的被弹出,找到站内的右侧第一个大于
				int oldIndex = stackIndex.pop();
				B[oldIndex] = i - oldIndex;
			}
			stackIndex.push(i);
		}
		return B;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int A[] = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		scanner.close();
		int[] B = nextGreater(A);
		for (int i = 0; i < B.length; i++) {
			System.out.println(B[i]);
		}
	}

}
